package com.shangxia.monomer.common.util;

import com.baomidou.mybatisplus.core.toolkit.AES;
import lombok.extern.slf4j.Slf4j;

/**
 * @ProjectName: monomer
 * @ClassName: EncryptionUtil
 * @Time: 2021/7/31
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class EncryptionUtil {
    /**
     * 数据安全保护 https://baomidou.com/guide/safety.html
     * @param args
     */
    public static void main(String[] args) {
        String salt = AES.generateRandomKey();
        String source1 = "root";
        String source2 = "jdbc:mysql://127.0.0.1:3306/rachel?useUnicode= &useSSL=false&characterEncoding=utf8&allowPublicKeyRetrieval=true";
        String result1 = AES.encrypt(source1, salt);
        String result2 = AES.encrypt(source2, salt);
        System.out.println(salt);
        System.out.println(result1);
        System.out.println(result2);
    }
}
